package com.ysdz.tibetan.tibetanmini.product.controller;

import com.ysdz.tibetan.tibetanminicommons.common.ReturnMsg;
import com.ysdz.tibetan.tibetanmini.product.service.CategoryDetailService;
import com.ysdz.tibetan.tibetanmini.product.service.CategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(value = "商品分类", tags = "商品分类控制器")
@RequestMapping("/category")
@RestController
@CrossOrigin
public class CategoryController {

    @Autowired
    private CategoryDetailService categoryDetailService;

    @Autowired
    private CategoryService categoryService;

    @ApiOperation("获取一级商品分类接口")
    @GetMapping("/categoryParent")
    public ReturnMsg getParentCategory(){
        return categoryService.getAllParentCategory();
    }

    @ApiOperation("获取所有商品分类接口")
    @GetMapping("/categoryAll")
    public void getAllCategory(){
         categoryService.getAllCategory();
    }

}
